Implicit Crank-Nicolson Scheme

In this example, we will solve the 1D heat equation

$\dfrac{\partial T}{\partial t} = \kappa \dfrac{\partial^2 T}{\partial x^2}$, with $\kappa = 1$

subject to the following boundary conditions:

To do this, we use the implicit Crank-Nicolson scheme.
This scheme is unconditionally stable, so we can choose any values of $\Delta t$ and $\Delta x$.

In the figures below, we vary $\Delta t$ and $\Delta x$ to see the effect on the solution.

Use the sliders vary $\Delta x$ and $\Delta t$ and compare the solutions here to those from the explicit time marching scheme in Lecture 5.


Fist, we change $\Delta t$ while keeping $\Delta x = 0.01$ fixed:



Next, we change $\Delta x$ while keeping $\Delta t = 5 \times 10^{-5}$ fixed: